package com.zjapl.web.action;

import com.opensymphony.xwork2.ActionSupport;
import com.zjapl.web.action.vo.Employee;
import com.zjapl.web.service.EmployeeService;
import com.zjapl.web.service.impl.EmployeeServiceImpl;
import com.zjapl.web.util.aes.AES;

/** 
 * @author 作者:方武斌    E-mail: fangwb@zjapl.com
 * @version 创建时间：2013-1-15 上午11:30:05 
 * 类说明 
 */
public class AddEmployeeAction extends ActionSupport{
	
	private static final long serialVersionUID = 1L;
	private String telephone1;
	private String telephone2;
	private Employee emp=new Employee();
	EmployeeService employeeServiceImpl=new EmployeeServiceImpl();
	
	/**  
	 * 获取emp  
	 * @return emp   
	 */
	public Employee getEmp() {
		return emp;
	}
	/**  
	 * 设置emp  
	 * @param emp emp  
	 */
	public void setEmp(Employee emp) {
		this.emp = emp;
	}
	/**  
	 * 获取telephone1  
	 * @return telephone1   
	 */
	public String getTelephone1() {
		return telephone1;
	}
	/**  
	 * 设置telephone1  
	 * @param telephone1 telephone1  
	 */
	public void setTelephone1(String telephone1) {
		this.telephone1 = telephone1;
	}
	/**  
	 * 获取telephone2  
	 * @return telephone2   
	 */
	public String getTelephone2() {
		return telephone2;
	}
	/**  
	 * 设置telephone2  
	 * @param telephone2 telephone2  
	 */
	public void setTelephone2(String telephone2) {
		this.telephone2 = telephone2;
	}
	
	public String execute() throws Exception {
	     String telephone=telephone1+"-"+telephone2;  
	     String passwordtmp="zjapl123456";
	     String Key="http://www.zjapl.com";
	 	 String password=AES.encrypttoStr(passwordtmp, Key);
	 	 emp.setPassword(password);
	 	 emp.setTelephone(telephone);
		if(employeeServiceImpl.addEmployee(emp)){
			return SUCCESS;
		}
		return ERROR;
	}

}
